<?php 
class CBasePage extends CBaseEosSingular {

	protected $m_intId;
	protected $m_strTitle;
	protected $m_strModule;
	protected $m_strDescription;
	protected $m_strMetaTitle;
	protected $m_strMetaKeywords;
	protected $m_strMetaDescription;
	protected $m_strViews;
	protected $m_strStatus;
		
	public function __construct() {		
		parent::__construct();
		return true;
	}
	
	/**************************************
	************* SET FUNCTIONS ***********
	**************************************/
	
	public function setId( $intId ) {
		$this->m_intId = $intId;
	}
	
	public function setTitle( $strTitle ) {
		$this->m_strTitle = $strTitle;
	}
	
	public function setModule( $strModule ) {
		$this->m_strModule = $strModule;
	}
	
	public function setDescription( $strDescription ) {
		$this->m_strDescription = $strDescription;
	}
	
	public function setMetaTitle( $strMetaTitle ) {
		$this->m_strMetaTitle = $strMetaTitle;
	}
	
	public function setMetaKeywords( $strMetaKeywords  ) {
		$this->m_strMetaKeywords = $strMetaKeywords ;
	}
	
	public function setMetaDescription( $strMetaDescription ) {
		$this->m_strMetaDescription = $strMetaDescription;
	}
	
	public function setViews( $strViews ) {
		$this->m_strViews = $strViews;
	}
	
	public function setStatus( $strStatus ) {
		$this->m_strStatus = $strStatus;
	}
	
	/**************************************
	************* GET FUNCTIONS ***********
	**************************************/
	
	public function getId() {
		return $this->m_intId;
	}
	
	public function getTitle() {
		return $this->m_strTitle;
	}
	
	public function getModule() {
		return $this->m_strModule;
	}
	
	public function getDescription() {
		return $this->m_strDescription;
	}
	
	public function getMetaTitle() {
		return $this->m_strMetaTitle;
	}
	
	public function getMetaKeywords() {
		return $this->m_strMetaKeywords;
	}
	
	public function getMetaDescription() {
		return $this->m_strMetaDescription;
	}
	
	public function getViews() {
		return $this->m_strViews;
	}
	
	public function getStatus() {
		return $this->m_strStatus;
	}
	
	/**************************************
	************* DATABASE FUNCTIONS ***********
	**************************************/
	
	public function insert( $objDatabase ) {
		$strSql  = ' INSERT INTO `pages` (`title`, `module`, `description`, `meta_title`, `meta_keywords`, `meta_description`, `views`, `status`)';   
		$strSql .= ' VALUES ( \'' . $this->getTitle() . '\',';
		$strSql .= ' \'' . $this->getModule() . '\',';
		$strSql .= ' \'' . $this->getDescription() . '\',';
		$strSql .= ' \'' . $this->getMetaTitle() . '\',';
		$strSql .= ' \'' . $this->getMetaKeywords() . '\',';
		$strSql .= ' \'' . $this->getMetaDescription() . '\',';
		$strSql .= ' \'' . $this->getViews() . '\',';	
		$strSql .= ' \'' . $this->getStatus() . '\');';

		return parent::insertRecord( $strSql, $objDatabase );
	}
	
	public function update( $objDatabase ) {
		$strSql  = ' UPDATE `pages` SET ';
		$strSql .= ' `title` = \'' . $this->getTitle() . '\',';
		$strSql .= ' `module` =  \'' . $this->getModule() . '\',';
		$strSql .= ' `description` = \'' . $this->getDescription() . '\',';
		$strSql .= ' `meta_title` = \'' . $this->getMetaTitle() . '\',';
		$strSql .= ' `meta_keywords` = \'' . $this->getMetaKeywords() . '\',';
		$strSql .= ' `meta_description` = \'' . $this->getMetaDescription() . '\',';
		$strSql .= ' `views` = \'' . $this->getViews() . '\',';
		$strSql .= ' `status` = \'' . $this->getStatus() . '\'';
		$strSql .= ' WHERE `id` = \'' . $this->getId() . '\';';
	
		return parent::updateRecord( $strSql, $objDatabase );
	}
		
	public function delete( $objDatabase ) {
		
		$strSql = ' DELETE FROM `pages` WHERE `id` = ' . $this->getId();
		return parent::deleteRecord( $strSql, $objDatabase );		
	}
	
}

?>